package com.bangbang.service.impl;

import com.bangbang.pojo.TbAdvertisingColumn;
import com.bangbang.mapper.TbAdvertisingColumnMapper;
import com.bangbang.service.ITbAdvertisingColumnService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 广告栏位分类表 服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2021-08-14
 */
@Service
public class TbAdvertisingColumnServiceImpl extends ServiceImpl<TbAdvertisingColumnMapper, TbAdvertisingColumn> implements ITbAdvertisingColumnService {
    @Autowired
    private TbAdvertisingColumnMapper columnMapper;

    @Override
    public List<TbAdvertisingColumn> queryCol(String isHoliday, Long colId) {
        //判断是否勾选假日 查询所有符合要求的栏位
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("col_id",colId);
        //没选择节假日
        if(StringUtils.equals(isHoliday,"0")){
            wrapper.eq("is_holiday",isHoliday);
        }
        List<TbAdvertisingColumn> columnList = columnMapper.selectList(wrapper);
        if(columnList.size()>0){
            return columnList;
        }
        return null;
    }
}
